/**
 * bsw_auto_thread.h
 * 显式链接 pthread 库
 * 
 * 竹影半墙
 * 2023.10
 */
#ifndef BSW_AUTO_THREAD_H
#define BSW_AUTO_THREAD_H

#include <pthread.h>
#include "bsw_compiler_auto.h"

typedef pthread_t       bsw_thread_id_t;
typedef pthread_attr_t  bsw_thread_attr_t;
typedef void *(bsw_thread_routine_f)(void *);

static bsw_always_inline int 
bsw_thread_create(bsw_thread_id_t *id, bsw_thread_attr_t *attr,
                 bsw_thread_routine_f routine, void *arg)
{
    return pthread_create(id, attr, routine, arg);
}

static bsw_always_inline int 
bsw_thread_join(bsw_thread_id_t *id, void **retval)
{
    return pthread_join(id, retval);
}

#endif